<?php

// 豆瓣 中用户图书记录的缓存 ..
class douban_user_m extends CI_Model{
	
	public static $m_collection = "nosql_douban_user_user";
	
	public $m_CI = null;
	
	public $mongodb = null;
	
	public function __construct()
	{
		parent::__construct();	
		$this->m_CI = &get_instance();

		$this->m_CI->load->library('MY_Mongo_db');

		$this->mongodb = $this->m_CI->my_mongo_db;
	}
	
	public function getList()
	{
		
	}
	public function addData($doubanID,$arrAdd)
	{
		$id = $this->mongodb->insert(self::$m_collection,array('doubanID' => $doubanID,'bookList' => $arrAdd));
	
		return $id;
	}
	
	public function  updateData()
	{
		
	}
	
	public function delData()
	{
		
	}
	
	public function clearData()
	{
		
	}
	
	public function isUserExist($doubanID)
	{
		$arrRet = array();
		$arrRet  = $this->mongodb->get_where(self::$m_collection,array('doubanID' => $doubanID),1);

		if (!empty($arrRet))
		{
			return true;
		}
		
		return false;
	}
	
}